<template>
  <div>
    <div
      class="wrapper-container"
      style="display: flex; flex-direction: column; width: 100%; margin: 0 50px"
    >
      <div class="search-container">
        <div class="search-container-left">
          <div
            class="search-container-item"
            v-for="(select, index) in selectList"
            :key="index"
          >
            <div v-if="select.type === 'selectTree'" class="box">
              <span v-show="select.name">{{ select.name }}</span>
              <el-popover
                trigger="click"
                placement="bottom"
                v-model="showUnitTree"
                style="cursor: pointer;"
                width="120">
                <div style="max-height: 260px;overflow-y: auto;">
                <el-tree
                      default-expand-all
                      node-key="id"
                      :data="select.valList"
                      :expand-on-click-node="false"
                      :props="props"
                      @node-click="toShowUnitInfo">
                </el-tree>
                </div>
                <el-input slot="reference" v-model="select.val" class="selectTree"
                    clearable :readonly="true" style="width: 120px;" suffix-icon="el-icon-arrow-down">
                </el-input>
              </el-popover>
            </div>
            <div v-if="select.type === 'select'" class="box">
              <span v-show="select.name">{{ select.name }}</span>

              <el-select
                v-model="select.val"
                style="width: 120px"
                size="mini"
                placeholder="请选择"
              >
                <el-option
                  v-for="item in select.valList"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value"
                >
                </el-option>
              </el-select>
            </div>
            <div v-if="select.type === 'btn'" class="box">
              <span class="demonstration" v-show="select.name">{{
                select.name
              }}</span>
              <el-input
                v-model="select.val"
                placeholder="请输入内容"
              ></el-input>
            </div>
          </div>
          <div class="search-button" style="margin-left: 20px" @click="queryList">
            <img src="../../../../assets/assessment/icon-search.png" alt="" />
            <span>查询</span>
          </div>
        </div>
      </div>
    </div>
    <div>
      <div class="title">2022春选修课花名册</div>
      <div class="top-cont">
        <el-row>
          <el-col :span="4">承担单位：</el-col>
          <el-col :span="8">XX教研室</el-col>
          <el-col :span="4">课程名称：</el-col>
          <el-col :span="8">篮球俱乐部</el-col>
        </el-row>
        <el-row>
          <el-col :span="4">教学班：</el-col>
          <el-col :span="8">2019级选修-篮球俱乐部jxb-1</el-col>
          <el-col :span="4">主讲教员：</el-col>
          <el-col :span="8">刘勇</el-col>
        </el-row>
      </div>
    </div>
    <div class="assessment-container">
      <div class="table-container">
        <el-table
          :data="tableList"
          border
          class="table-data"
          row-class-name="row-class"
          cell-class-name="cell-class"
          header-row-class-name="header-row-class"
          header-cell-class-name="header-cell-class"
          style="height: calc(100vh - 370px); overflow-y: auto"
          :span-method="objectSpanMethod"
        >
        <el-table-column
          prop="numName"
          width="80"
          label="序号"
          align="center"
        >
        </el-table-column>
          <el-table-column prop="bx" label="学号" align="center">
          </el-table-column>
          <el-table-column prop="jys" label="姓名" align="center">
          </el-table-column>
          <el-table-column prop="zs" label="专业班次" align="center">
          </el-table-column>
          <el-table-column prop="wfb" label="签到" align="center">
          </el-table-column>
          <el-table-column prop="wfb" label="总评成绩" align="center">
          </el-table-column>
          <el-table-column prop="wfb" label="备注" align="center">
          </el-table-column>
        </el-table>
      </div>
    </div>
  </div>
</template>

<script>
import ButtonItem from "@/components/ButtonItem.vue";
import SelectItem from "@/components/SelectItem.vue";

import {queryCommonXueqi, queryCommonCoursList, queryCommonDept} from "@/api/trainingManagement/place.js";


export default {
  components: {
    ButtonItem,
    SelectItem,
  },
  data() {
    return {
      props:{
        children: "children",
        label: "name",
      },
      treeOptionList: [], //单位下拉树
      showUnitTree: false, //
      unitId: "", //单位id
      userRole: "admin", //用户角色 admin 管理员, other
      tableList: [],
      selectList: [
        {
          type: "select",
          name: "学期:",
          val: "",
          valList: [],
        },
        {
          type: "selectTree",
          name: "承担单位:",
          val: "",
        },
         {
          type: "select",
          name: "课程名称:",
          val: "",
          valList:[]
        },
      ],
    };
  },
  created() {},
  mounted() {

  },
  methods: {
    queryList() {

    },
    toShowUnitInfo(data) {
      this.selectList[1].val = data.name;
      this.unitId = data.id;
      this.showUnitTree = false;
        // this.query();
    },
    async queryCommonDept() {
      const res = await queryCommonDept();
      if (res.data.code == 200) {
        this.selectList[1].valList = res.data.data;
        this.selectList[1].val = this.selectList[1].valList[0].name;
        // this.unitId = this.selectList[1].valList[0].id;
      }
    },
    // 获取学期列表
    async queryCommonXueqi() {
      const res = await queryCommonXueqi();
      if (res.data.code == 200) {
        this.selectList[0].valList = res.data.data;
        this.selectList[0].val = this.selectList[0].valList[0].id
      }
    },
    async queryCommonXueqi() {
      const res = await queryCommonXueqi();
      if (res.data.code == 200) {
        this.selectList[2].valList = res.data.data;
      }
    },
    queryCommonCoursList
  },
  computed: {}, //计算属性
};
</script>
<style lang="less" scoped>
.assessment-container {
  .el-dialog__body {
    height: 251px;
  }
  .el-dialog__footer {
    padding: 10px 20px 45px;
  }
  .el-checkbox__inner:hover {
    border-color: #004ca7;
  }
  .el-checkbox__inner {
    border: 1px solid #004ca7;
    border-radius: 0;
    height: 18px;
    width: 18px;
  }
  .el-checkbox__inner::after {
    height: 10px;
    left: 6px;
  }
  .el-checkbox__input.is-checked .el-checkbox__inner,
  .el-checkbox__input.is-indeterminate .el-checkbox__inner {
    background-color: #004ca7;
    border-color: #004ca7;
  }
  .el-checkbox__input.is-checked + .el-checkbox__label {
    color: #004ca7;
  }
  .el-checkbox.is-bordered.is-checked {
    border-color: #004ca7;
  }
  .el-checkbox__input.is-focus .el-checkbox__inner {
    border-color: #004ca7;
  }
}
</style>
<style lang="less" scoped>
@import "../../../../styles/text.less";
.pagination-block {
  margin-top: 20px;
  display: flex;
  flex-direction: row;
  justify-content: center;
}
</style>
<style lang="less" scoped>
@import "../../../../styles/supervision.less";

.wrapper-container {
  width: 1711px;
  margin: 0 auto;
}

/deep/ .table-container {
  .el-table td,
  .el-table th.is-leaf,
  .el-table--border,
  .el-table--group {
    border-color: #c7d7eb;
  }

  .el-table__header tr,
  .el-table__header th {
    padding: 0;
    height: 76px;
    background-color: #edf2f9;
    font-size: 16px;
    font-family: Microsoft YaHei;
    font-weight: bold;
    line-height: 20px;
    color: #004ca7;
  }

  .el-table__body tr,
  .el-table__body td {
    padding: 0;
    height: 86px;
  }

  .wrapper-button {
    display: flex;
    flex-direction: column;
    align-items: center;

    > div {
      margin-bottom: 8px;
    }
  }
  .table-data {
    width: 100%;
    border: 0.8px solid #004ca7;
    /*border-radius: 9px;*/
    font-size: 14px;
    font-family: Microsoft YaHei;
    font-weight: 400;
    color: #004ca7;
  }
}

.wrapper-container .search-container .search-container-left {
  width: 100%;
  flex-wrap: wrap;
  .search-container-item {
    width: 12%;
    margin-right: 0px;
    .box {
      > span {
        text-align: left;
      }
      display: flex;
      justify-content: space-evenly;
      margin-bottom: 20px;
      align-items: center;
      /deep/ .el-input__inner {
        height: 28px;
      }
    }
  }
}

/deep/.el-date-editor.el-input {
  width: 110px;
}
/deep/ .el-input--medium {
  width: 110px;
  .el-input__inner {
    height: 28px;
    width: 110px;
    padding: 0px 18px;
  }
}
/deep/ .el-table thead {
  color: #004ca7 !important;
}

.btn {
  margin-top: 271px;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 271px;
  .submit {
    width: 84px;
    height: 27px;
    line-height: 8px;
  }
}
.bottom-block {
  // display: flex;
  flex-direction: row;
  justify-content: space-between !important;
  .export-button {
    width: 127px;
    height: 27px;
    background: #fff6ef;
    border: 1px solid #f3b815;
    border-radius: 4px;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    margin-top: 14px;
    > img {
      width: 17px;
      height: 17px;
    }
    > span {
      margin-left: 12px;
      font-size: 14px;
      font-family: Microsoft YaHei;
      font-weight: 400;
      color: #f3b815;
    }
  }
  .text {
    font-size: 14px;
    font-family: Microsoft YaHei;
    font-weight: 400;
    line-height: 39px;
    color: #004ca7;
  }
}

.search-button {
  width: 77px;
  height: 28px;
  line-height: 28px;
  background: #f1f8fe;
  border: 1px solid #51aef6;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  > span {
    font-size: 16px;
    font-family: Microsoft YaHei;
    font-weight: 400;
    color: #51aef6;
  }
  > img {
    width: 20px;
    height: 20px;
    margin-right: 4px;
  }
}

.body-manual-container {
  > div:nth-child(1) {
    width: 1742px;
    // height: 785px;
    border: 1px solid rgba(0, 76, 167, 0.8);
    border-radius: 6px;
    margin: 30px auto 0;
    ul {
      list-style: none;
      li:nth-child(n) {
        border-bottom: 1px solid rgba(0, 76, 167, 0.4);
        height: auto;
        > span {
          box-sizing: border-box;
          display: inline-block;
          font-size: 14px;
          color: rgba(0, 76, 167, 1);
          // padding-left: 54px;
          border-right: 1px solid rgba(0, 76, 167, 0.4);
          height: 60px;
          // padding-top: 20px;
          vertical-align: middle;
          &:nth-child(n) {
            width: 215px;
            height: 100px;
          }
          &:last-child {
            border-right: none;
          }
          &.active {
            font-size: 16px;
            color: rgba(0, 76, 167, 1);
            font-weight: bold;
            background: rgba(77, 129, 192, 0.1);
            text-align: center;
            padding-left: 0;
          }
          > span {
            color: rgba(255, 56, 25, 1);
          }
          > div {
            width: 100%;
            height: 100%;
            display: flex;
            align-items: center;
            justify-content: center;
          }
        }
      }
      li:nth-child(1) {
        > span {
          &:nth-child(n) {
            width: 215px;
            height: 60px;
            font-weight: bold;
          }
          > div {
            width: 100%;
            height: 100%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 16px;
          }
        }
      }
    }
  }
}

/deep/ .el-tree-node {
  color: #004ca7;
}

.assessment-container {
  width: calc(100% - 20px);
  .table-container {
     width: 100%;
  }
}

.title {
  text-align: center;
    font-size: 24px;
    color: #999;
    font-weight: bold;
    margin-bottom: 20px;
}

.top-cont {
      width: calc(100% - 40px);
    margin: 0 auto;
    color: #999;
    font-size: 18px;
}
</style>
